package com.ikun.admin.modules.other;

import com.ikun.common.manager.fileHandler.FileManger;
import com.ikun.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @ClassName FileUploadController
 * @Description: 文件上传接口
 * @CreateDate: 2024/7/9 16:16
 */
@RequestMapping("/file/upload")
@RestController
public class FileUploadController {
    @Autowired
    private FileManger fileManger;

    @PostMapping("/fileList")
    public Result<List<String>> uploadFileList(@RequestBody List<MultipartFile> fileList) throws IOException {
        return fileManger.uploadFileList(fileList);
    }

    @PostMapping("/file")
    public Result<String> uploadFile(@RequestBody MultipartFile file) throws IOException {
        return fileManger.uploadFile(file);
    }
}
